<template>
  <div id="shop">
    <Button
      :checked="items.checked"
      @click.native="checkClick"
      class="checked-button"
    ></Button>
    <div class="shop-img">
      <img :src="items.img" alt="商品图片" />
    </div>
    <div class="shop-info">
      <div class="title">{{ items.title }}</div>
      <div class="desc">商品描述: {{ items.desc }}</div>
      <div class="shop-bottom">
        <div class="price">¥{{ items.Price }}</div>
        <div class="const">x{{ items.const }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import Button from './cartbutton.vue'
export default {
  name: 'cartitem',
  components: {
    Button,
  },
  data() {
    return {}
  },
  props: {
    items: {
      type: Object,
      default() {
        return {}
      },
    },
  },
  computed: {},

  methods: {
    checkClick() {
      this.items.checked = !this.items.checked
    },
  },
}
</script>
<style scoped>
#shop {
  width: 100%;
  display: flex;
  padding: 5px;
  border-bottom: 1px solid #ccc;
}
.shop-img {
  padding: 5px;
}

.shop-img img {
  width: 80px;
  height: 100px;
  display: block;
  border-radius: 5px;
}
.shop-info {
  font-size: 17px;
  color: #333;
  padding: 5px 10px;
  position: relative;
  overflow: hidden;
}
.title,
.desc {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.desc {
  font-size: 14px;
  color: #666;
  margin-top: 15px;
}
.shop-bottom {
  margin-top: 10px;
  position: absolute;
  right: 14%;
}
.shop-bottom .price {
  color: orangered;
}
.shop-bottom .const {
  margin-left: 65%;
}
.checked-button {
  position: relative;
  top: 42px;
  width: 20px;
  height: 20px;
}
</style>
